// 刚刚封装的axios
import request from './http';

// 1.获取图片验证码
export const getImgCode = () => {
    return request({
        url: '/sys_user/getImage',
        method: 'get',
        // 图片验证码 response类型设置成blob，图片才能显示出来
        responseType: "blob"
    })
}
// 2.注册用户
export const register = (query) => {
    return request({
        url: '/sys_user/register',
        method: 'post',
        // headers:{
        //     'Content-Type': 'application/x-www-form-urlencoded'
        // },
        data: query
    })
}
// 3.登录用户
export const login = (query) => {
    return request({
        url: '/sys_user/login',
        method: 'post',
        data: query
    })
}
// 4.退出登录
export const logout = () => {
    return request({
        url: '/sys_user/logout',
        method: 'post'
    })
}

// 2.获取手机验证码
export const getPhoneCode = (query) => {
    return request({
        url: '/user/messageCode',
        method: 'post',
        data: query
    })
}

// 3. 获取用户任务列表
export const getUserTask = (query) => {
    return request({
        url: '/task/select',
        method: 'get',
        params: query
    })
}

// 4. 搜索任务接口
export const queryTask = (query1, query2) => {
    return request({
        url: '/task/query',
        method: 'post',
        data: query1,
        params: query2
    })
}
